/***********************************************
/gen auto by zuitools
***********************************************/
#include "mainActivity.h"

/*TAG:GlobalVariable全局变量*/
static ZKButton* mButton90Ptr;
static ZKButton* mButton89Ptr;
static ZKButton* mButton88Ptr;
static ZKTextView* mTextView64Ptr;
static ZKTextView* mTextView63Ptr;
static ZKButton* mButton87Ptr;
static ZKTextView* mTextView62Ptr;
static ZKButton* mButton86Ptr;
static ZKButton* mButton85Ptr;
static ZKButton* mButton84Ptr;
static ZKButton* mButton83Ptr;
static ZKButton* mButton82Ptr;
static ZKTextView* mTextView61Ptr;
static ZKTextView* mTextView60Ptr;
static ZKTextView* mTextView59Ptr;
static ZKTextView* mTextView58Ptr;
static ZKTextView* mTextView57Ptr;
static ZKButton* mButton81Ptr;
static ZKButton* mButton80Ptr;
static ZKButton* mButton79Ptr;
static ZKTextView* mTextView56Ptr;
static ZKButton* mButton78Ptr;
static ZKTextView* mTextView55Ptr;
static ZKTextView* mTextView54Ptr;
static ZKButton* mButton77Ptr;
static ZKButton* mButton76Ptr;
static ZKButton* mButton75Ptr;
static ZKTextView* mTextView53Ptr;
static ZKButton* mButton74Ptr;
static ZKButton* mButton73Ptr;
static ZKTextView* mTextView52Ptr;
static ZKTextView* mTextView51Ptr;
static ZKTextView* mTextView50Ptr;
static ZKTextView* mTextView49Ptr;
static ZKTextView* mTextView48Ptr;
static ZKButton* mButton72Ptr;
static ZKButton* mButton71Ptr;
static ZKButton* mButton70Ptr;
static ZKTextView* mTextView47Ptr;
static ZKTextView* mTextView46Ptr;
static ZKTextView* mTextView45Ptr;
static ZKTextView* mTextView44Ptr;
static ZKTextView* mTextView43Ptr;
static ZKButton* mButton69Ptr;
static ZKButton* mButton68Ptr;
static ZKTextView* mTextView42Ptr;
static ZKButton* mButton67Ptr;
static ZKButton* mButton66Ptr;
static ZKTextView* mTextView41Ptr;
static ZKTextView* mTextView40Ptr;
static ZKTextView* mTextView39Ptr;
static ZKTextView* mTextView38Ptr;
static ZKButton* mButton65Ptr;
static ZKButton* mButton64Ptr;
static ZKTextView* mTextView37Ptr;
static ZKButton* mButton63Ptr;
static ZKTextView* mTextView36Ptr;
static ZKButton* mButton62Ptr;
static ZKButton* mButton61Ptr;
static ZKTextView* mTextView35Ptr;
static ZKTextView* mTextView34Ptr;
static ZKButton* mButton60Ptr;
static ZKButton* mButton59Ptr;
static ZKTextView* mTextView33Ptr;
static ZKButton* mButton58Ptr;
static ZKButton* mButton57Ptr;
static ZKButton* mButton56Ptr;
static ZKButton* mButton55Ptr;
static ZKButton* mButton54Ptr;
static ZKButton* mButton53Ptr;
static ZKTextView* mTextView32Ptr;
static ZKTextView* mTextView31Ptr;
static ZKTextView* mTextView30Ptr;
static ZKTextView* mTextView29Ptr;
static ZKTextView* mTextView28Ptr;
static ZKTextView* mTextView27Ptr;
static ZKTextView* mTextView26Ptr;
static ZKTextView* mTextView25Ptr;
static ZKButton* mButton52Ptr;
static ZKButton* mButton51Ptr;
static ZKButton* mButton50Ptr;
static ZKTextView* mTextView24Ptr;
static ZKTextView* mTextView23Ptr;
static ZKButton* mButton49Ptr;
static ZKButton* mButton48Ptr;
static ZKTextView* mTextView22Ptr;
static ZKButton* mButton47Ptr;
static ZKButton* mButton46Ptr;
static ZKButton* mButton45Ptr;
static ZKButton* mButton44Ptr;
static ZKButton* mButton43Ptr;
static ZKButton* mButton42Ptr;
static ZKTextView* mTextView21Ptr;
static ZKTextView* mTextView20Ptr;
static ZKTextView* mTextView19Ptr;
static ZKTextView* mTextView18Ptr;
static ZKTextView* mTextView17Ptr;
static ZKTextView* mTextView16Ptr;
static ZKTextView* mTextView15Ptr;
static ZKTextView* mTextView14Ptr;
static ZKButton* mButton41Ptr;
static ZKButton* mButton40Ptr;
static ZKButton* mButton39Ptr;
static ZKButton* mButton38Ptr;
static ZKButton* mButton37Ptr;
static ZKButton* mButton36Ptr;
static ZKButton* mButton35Ptr;
static ZKButton* mButton34Ptr;
static ZKButton* mButton33Ptr;
static ZKButton* mButton32Ptr;
static ZKButton* mButton31Ptr;
static ZKButton* mButton30Ptr;
static ZKTextView* mTextView13Ptr;
static ZKTextView* mTextView12Ptr;
static ZKTextView* mTextView11Ptr;
static ZKButton* mButton29Ptr;
static ZKTextView* mTextView10Ptr;
static ZKTextView* mTextView9Ptr;
static ZKTextView* mTextView8Ptr;
static ZKTextView* mTextView7Ptr;
static ZKTextView* mTextView6Ptr;
static ZKTextView* mTextView5Ptr;
static ZKTextView* mTextView4Ptr;
static ZKTextView* mTextView3Ptr;
static ZKTextView* mZaxisPPtr;
static ZKTextView* mYaxisPPtr;
static ZKTextView* mXaxisPPtr;
static ZKEditText* mFileNamePtr;
static ZKButton* mButton28Ptr;
static ZKButton* mButton27Ptr;
static ZKButton* mButton26Ptr;
static ZKButton* mButton25Ptr;
static ZKTextView* mTextView2Ptr;
static ZKTextView* mTextView1Ptr;
static ZKListView* mListView1Ptr;
static ZKPainter* mPainter3Ptr;
static ZKWindow* mFileWindowPtr;
static ZKButton* mButton24Ptr;
static ZKTextView* mTextview29Ptr;
static ZKTextView* mTextview28Ptr;
static ZKWindow* mConfigWindow4Ptr;
static ZKTextView* mTextview27Ptr;
static ZKWindow* mConfigWindow3Ptr;
static ZKTextView* mTextview26Ptr;
static ZKWindow* mConfigWindow2Ptr;
static ZKTextView* mTextview25Ptr;
static ZKWindow* mConfigWindow1Ptr;
static ZKButton* mButton23Ptr;
static ZKButton* mButton22Ptr;
static ZKButton* mButton19Ptr;
static ZKButton* mButton17Ptr;
static ZKWindow* mConfigWindowsPtr;
static ZKTextView* mTextview24Ptr;
static ZKWindow* mMonitorWindow3Ptr;
static ZKTextView* mTextview23Ptr;
static ZKWindow* mMonitorWindow2Ptr;
static ZKWindow* mMonitorWindow1Ptr;
static ZKButton* mButton21Ptr;
static ZKButton* mButton18Ptr;
static ZKButton* mButton20Ptr;
static ZKWindow* mMonitorWindowsPtr;
static ZKTextView* mTextview21Ptr;
static ZKWindow* mTeachWindow4Ptr;
static ZKTextView* mTextview20Ptr;
static ZKWindow* mTeachWindow3Ptr;
static ZKTextView* mTextview19Ptr;
static ZKWindow* mTeachWindow2Ptr;
static ZKListView* mListview1Ptr;
static ZKButton* mButton16Ptr;
static ZKButton* mButton15Ptr;
static ZKButton* mButton14Ptr;
static ZKButton* mButton13Ptr;
static ZKTextView* mTextview15Ptr;
static ZKWindow* mTeachWindow1Ptr;
static ZKWindow* mTeachWindowsPtr;
static ZKTextView* mTextview17Ptr;
static ZKWindow* mFuncWindow3Ptr;
static ZKTextView* mTextview16Ptr;
static ZKWindow* mFuncWindow2Ptr;
static ZKTextView* mTextview14Ptr;
static ZKWindow* mFuncWindow1Ptr;
static ZKButton* mButton4Ptr;
static ZKButton* mButton12Ptr;
static ZKButton* mButton11Ptr;
static ZKWindow* mFuncWindowsPtr;
static ZKTextView* mTextview6Ptr;
static ZKButton* mButton7Ptr;
static ZKTextView* mTextview11Ptr;
static ZKTextView* mTextview9Ptr;
static ZKTextView* mTextview4Ptr;
static ZKTextView* mTextview10Ptr;
static ZKButton* mButton10Ptr;
static ZKButton* mButton5Ptr;
static ZKTextView* mTextview8Ptr;
static ZKTextView* mTextview13Ptr;
static ZKButton* mButton1Ptr;
static ZKButton* mButton3Ptr;
static ZKTextView* mTextview12Ptr;
static ZKTextView* mTextview5Ptr;
static ZKButton* mButton2Ptr;
static ZKButton* mButton9Ptr;
static ZKButton* mButton6Ptr;
static ZKButton* mButton8Ptr;
static ZKTextView* mTextview18Ptr;
static ZKDigitalClock* mDigitalclock1Ptr;
static ZKTextView* mTextview2Ptr;
static ZKPainter* mPainter2Ptr;
static ZKPainter* mPainter1Ptr;
static ZKTextView* mTextview1Ptr;
static mainActivity* mActivityPtr;

/*register activity*/
REGISTER_ACTIVITY(mainActivity);

typedef struct {
	int id; // 定时器ID ， 不能重复
	int time; // 定时器  时间间隔  单位 毫秒
}S_ACTIVITY_TIMEER;

#include "logic/mainLogic.cc"

/***********/
typedef struct {
    int id;
    const char *pApp;
} SAppInfo;

/**
 *点击跳转window
 */
static SAppInfo sAppInfoTab[] = {
//  { ID_MAIN_TEXT, "TextViewActivity" },
};

/***************/
typedef bool (*ButtonCallback)(ZKButton *pButton);
/**
 * button onclick表
 */
typedef struct {
    int id;
    ButtonCallback callback;
}S_ButtonCallback;

/*TAG:ButtonCallbackTab按键映射表*/
static S_ButtonCallback sButtonCallbackTab[] = {
    ID_MAIN_Button90, onButtonClick_Button90,
    ID_MAIN_Button89, onButtonClick_Button89,
    ID_MAIN_Button88, onButtonClick_Button88,
    ID_MAIN_Button87, onButtonClick_Button87,
    ID_MAIN_Button86, onButtonClick_Button86,
    ID_MAIN_Button85, onButtonClick_Button85,
    ID_MAIN_Button84, onButtonClick_Button84,
    ID_MAIN_Button83, onButtonClick_Button83,
    ID_MAIN_Button82, onButtonClick_Button82,
    ID_MAIN_Button81, onButtonClick_Button81,
    ID_MAIN_Button80, onButtonClick_Button80,
    ID_MAIN_Button79, onButtonClick_Button79,
    ID_MAIN_Button78, onButtonClick_Button78,
    ID_MAIN_Button77, onButtonClick_Button77,
    ID_MAIN_Button76, onButtonClick_Button76,
    ID_MAIN_Button75, onButtonClick_Button75,
    ID_MAIN_Button74, onButtonClick_Button74,
    ID_MAIN_Button73, onButtonClick_Button73,
    ID_MAIN_Button72, onButtonClick_Button72,
    ID_MAIN_Button71, onButtonClick_Button71,
    ID_MAIN_Button70, onButtonClick_Button70,
    ID_MAIN_Button69, onButtonClick_Button69,
    ID_MAIN_Button68, onButtonClick_Button68,
    ID_MAIN_Button67, onButtonClick_Button67,
    ID_MAIN_Button66, onButtonClick_Button66,
    ID_MAIN_Button65, onButtonClick_Button65,
    ID_MAIN_Button64, onButtonClick_Button64,
    ID_MAIN_Button63, onButtonClick_Button63,
    ID_MAIN_Button62, onButtonClick_Button62,
    ID_MAIN_Button61, onButtonClick_Button61,
    ID_MAIN_Button60, onButtonClick_Button60,
    ID_MAIN_Button59, onButtonClick_Button59,
    ID_MAIN_Button58, onButtonClick_Button58,
    ID_MAIN_Button57, onButtonClick_Button57,
    ID_MAIN_Button56, onButtonClick_Button56,
    ID_MAIN_Button55, onButtonClick_Button55,
    ID_MAIN_Button54, onButtonClick_Button54,
    ID_MAIN_Button53, onButtonClick_Button53,
    ID_MAIN_Button52, onButtonClick_Button52,
    ID_MAIN_Button51, onButtonClick_Button51,
    ID_MAIN_Button50, onButtonClick_Button50,
    ID_MAIN_Button49, onButtonClick_Button49,
    ID_MAIN_Button48, onButtonClick_Button48,
    ID_MAIN_Button47, onButtonClick_Button47,
    ID_MAIN_Button46, onButtonClick_Button46,
    ID_MAIN_Button45, onButtonClick_Button45,
    ID_MAIN_Button44, onButtonClick_Button44,
    ID_MAIN_Button43, onButtonClick_Button43,
    ID_MAIN_Button42, onButtonClick_Button42,
    ID_MAIN_Button41, onButtonClick_Button41,
    ID_MAIN_Button40, onButtonClick_Button40,
    ID_MAIN_Button39, onButtonClick_Button39,
    ID_MAIN_Button38, onButtonClick_Button38,
    ID_MAIN_Button37, onButtonClick_Button37,
    ID_MAIN_Button36, onButtonClick_Button36,
    ID_MAIN_Button35, onButtonClick_Button35,
    ID_MAIN_Button34, onButtonClick_Button34,
    ID_MAIN_Button33, onButtonClick_Button33,
    ID_MAIN_Button32, onButtonClick_Button32,
    ID_MAIN_Button31, onButtonClick_Button31,
    ID_MAIN_Button30, onButtonClick_Button30,
    ID_MAIN_Button29, onButtonClick_Button29,
    ID_MAIN_Button28, onButtonClick_Button28,
    ID_MAIN_Button27, onButtonClick_Button27,
    ID_MAIN_Button26, onButtonClick_Button26,
    ID_MAIN_Button25, onButtonClick_Button25,
    ID_MAIN_Button24, onButtonClick_Button24,
    ID_MAIN_Button23, onButtonClick_Button23,
    ID_MAIN_Button22, onButtonClick_Button22,
    ID_MAIN_Button19, onButtonClick_Button19,
    ID_MAIN_Button17, onButtonClick_Button17,
    ID_MAIN_Button21, onButtonClick_Button21,
    ID_MAIN_Button18, onButtonClick_Button18,
    ID_MAIN_Button20, onButtonClick_Button20,
    ID_MAIN_Button16, onButtonClick_Button16,
    ID_MAIN_Button15, onButtonClick_Button15,
    ID_MAIN_Button14, onButtonClick_Button14,
    ID_MAIN_Button13, onButtonClick_Button13,
    ID_MAIN_Button4, onButtonClick_Button4,
    ID_MAIN_Button12, onButtonClick_Button12,
    ID_MAIN_Button11, onButtonClick_Button11,
    ID_MAIN_Button7, onButtonClick_Button7,
    ID_MAIN_Button10, onButtonClick_Button10,
    ID_MAIN_Button5, onButtonClick_Button5,
    ID_MAIN_Button1, onButtonClick_Button1,
    ID_MAIN_Button3, onButtonClick_Button3,
    ID_MAIN_Button2, onButtonClick_Button2,
    ID_MAIN_Button9, onButtonClick_Button9,
    ID_MAIN_Button6, onButtonClick_Button6,
    ID_MAIN_Button8, onButtonClick_Button8,
};
/***************/


typedef void (*SeekBarCallback)(ZKSeekBar *pSeekBar, int progress);
typedef struct {
    int id;
    SeekBarCallback callback;
}S_ZKSeekBarCallback;
/*TAG:SeekBarCallbackTab*/
static S_ZKSeekBarCallback SZKSeekBarCallbackTab[] = {
};


typedef int (*ListViewGetItemCountCallback)(const ZKListView *pListView);
typedef void (*ListViewobtainListItemDataCallback)(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index);
typedef void (*ListViewonItemClickCallback)(ZKListView *pListView, int index, int id);
typedef struct {
    int id;
    ListViewGetItemCountCallback getListItemCountCallback;
    ListViewobtainListItemDataCallback obtainListItemDataCallback;
    ListViewonItemClickCallback onItemClickCallback;
}S_ListViewFunctionsCallback;
/*TAG:ListViewFunctionsCallback*/
static S_ListViewFunctionsCallback SListViewFunctionsCallbackTab[] = {
    ID_MAIN_ListView1, getListItemCount_ListView1, obtainListItemData_ListView1, onListItemClick_ListView1,
    ID_MAIN_Listview1, getListItemCount_Listview1, obtainListItemData_Listview1, onListItemClick_Listview1,
};


typedef void (*SlideWindowItemClickCallback)(ZKSlideWindow *pSlideWindow, int index);
typedef struct {
    int id;
    SlideWindowItemClickCallback onSlideItemClickCallback;
}S_SlideWindowItemClickCallback;
/*TAG:SlideWindowFunctionsCallbackTab*/
static S_SlideWindowItemClickCallback SSlideWindowItemClickCallbackTab[] = {
};


typedef void (*EditTextInputCallback)(const std::string &text);
typedef struct {
    int id;
    EditTextInputCallback onEditTextChangedCallback;
}S_EditTextInputCallback;
/*TAG:EditTextInputCallback*/
static S_EditTextInputCallback SEditTextInputCallbackTab[] = {
    ID_MAIN_FileName, onEditTextChanged_FileName,
};

typedef void (*VideoViewCallback)(ZKVideoView *pVideoView, int msg);
typedef struct {
    int id; //VideoView ID
    bool loop; // 是否是轮播类型
    int defaultvolume;//轮播类型时,默认视频音量
    VideoViewCallback onVideoViewCallback;
}S_VideoViewCallback;
/*TAG:VideoViewCallback*/
static S_VideoViewCallback SVideoViewCallbackTab[] = {
};


mainActivity::mainActivity() {
	//todo add init code here
	mVideoLoopIndex = -1;
	mVideoLoopErrorCount = 0;
}

mainActivity::~mainActivity() {
  //todo add init file here
  // 退出应用时需要反注册
    EASYUICONTEXT->unregisterGlobalTouchListener(this);
    onUI_quit();
    unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
}

const char* mainActivity::getAppName() const{
	return "main.ftu";
}

//TAG:onCreate
void mainActivity::onCreate() {
	Activity::onCreate();
    mButton90Ptr = (ZKButton*)findControlByID(ID_MAIN_Button90);
    mButton89Ptr = (ZKButton*)findControlByID(ID_MAIN_Button89);
    mButton88Ptr = (ZKButton*)findControlByID(ID_MAIN_Button88);
    mTextView64Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView64);
    mTextView63Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView63);
    mButton87Ptr = (ZKButton*)findControlByID(ID_MAIN_Button87);
    mTextView62Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView62);
    mButton86Ptr = (ZKButton*)findControlByID(ID_MAIN_Button86);
    mButton85Ptr = (ZKButton*)findControlByID(ID_MAIN_Button85);
    mButton84Ptr = (ZKButton*)findControlByID(ID_MAIN_Button84);
    mButton83Ptr = (ZKButton*)findControlByID(ID_MAIN_Button83);
    mButton82Ptr = (ZKButton*)findControlByID(ID_MAIN_Button82);
    mTextView61Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView61);
    mTextView60Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView60);
    mTextView59Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView59);
    mTextView58Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView58);
    mTextView57Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView57);
    mButton81Ptr = (ZKButton*)findControlByID(ID_MAIN_Button81);
    mButton80Ptr = (ZKButton*)findControlByID(ID_MAIN_Button80);
    mButton79Ptr = (ZKButton*)findControlByID(ID_MAIN_Button79);
    mTextView56Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView56);
    mButton78Ptr = (ZKButton*)findControlByID(ID_MAIN_Button78);
    mTextView55Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView55);
    mTextView54Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView54);
    mButton77Ptr = (ZKButton*)findControlByID(ID_MAIN_Button77);
    mButton76Ptr = (ZKButton*)findControlByID(ID_MAIN_Button76);
    mButton75Ptr = (ZKButton*)findControlByID(ID_MAIN_Button75);
    mTextView53Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView53);
    mButton74Ptr = (ZKButton*)findControlByID(ID_MAIN_Button74);
    mButton73Ptr = (ZKButton*)findControlByID(ID_MAIN_Button73);
    mTextView52Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView52);
    mTextView51Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView51);
    mTextView50Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView50);
    mTextView49Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView49);
    mTextView48Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView48);
    mButton72Ptr = (ZKButton*)findControlByID(ID_MAIN_Button72);
    mButton71Ptr = (ZKButton*)findControlByID(ID_MAIN_Button71);
    mButton70Ptr = (ZKButton*)findControlByID(ID_MAIN_Button70);
    mTextView47Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView47);
    mTextView46Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView46);
    mTextView45Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView45);
    mTextView44Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView44);
    mTextView43Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView43);
    mButton69Ptr = (ZKButton*)findControlByID(ID_MAIN_Button69);
    mButton68Ptr = (ZKButton*)findControlByID(ID_MAIN_Button68);
    mTextView42Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView42);
    mButton67Ptr = (ZKButton*)findControlByID(ID_MAIN_Button67);
    mButton66Ptr = (ZKButton*)findControlByID(ID_MAIN_Button66);
    mTextView41Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView41);
    mTextView40Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView40);
    mTextView39Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView39);
    mTextView38Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView38);
    mButton65Ptr = (ZKButton*)findControlByID(ID_MAIN_Button65);
    mButton64Ptr = (ZKButton*)findControlByID(ID_MAIN_Button64);
    mTextView37Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView37);
    mButton63Ptr = (ZKButton*)findControlByID(ID_MAIN_Button63);
    mTextView36Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView36);
    mButton62Ptr = (ZKButton*)findControlByID(ID_MAIN_Button62);
    mButton61Ptr = (ZKButton*)findControlByID(ID_MAIN_Button61);
    mTextView35Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView35);
    mTextView34Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView34);
    mButton60Ptr = (ZKButton*)findControlByID(ID_MAIN_Button60);
    mButton59Ptr = (ZKButton*)findControlByID(ID_MAIN_Button59);
    mTextView33Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView33);
    mButton58Ptr = (ZKButton*)findControlByID(ID_MAIN_Button58);
    mButton57Ptr = (ZKButton*)findControlByID(ID_MAIN_Button57);
    mButton56Ptr = (ZKButton*)findControlByID(ID_MAIN_Button56);
    mButton55Ptr = (ZKButton*)findControlByID(ID_MAIN_Button55);
    mButton54Ptr = (ZKButton*)findControlByID(ID_MAIN_Button54);
    mButton53Ptr = (ZKButton*)findControlByID(ID_MAIN_Button53);
    mTextView32Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView32);
    mTextView31Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView31);
    mTextView30Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView30);
    mTextView29Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView29);
    mTextView28Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView28);
    mTextView27Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView27);
    mTextView26Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView26);
    mTextView25Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView25);
    mButton52Ptr = (ZKButton*)findControlByID(ID_MAIN_Button52);
    mButton51Ptr = (ZKButton*)findControlByID(ID_MAIN_Button51);
    mButton50Ptr = (ZKButton*)findControlByID(ID_MAIN_Button50);
    mTextView24Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView24);
    mTextView23Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView23);
    mButton49Ptr = (ZKButton*)findControlByID(ID_MAIN_Button49);
    mButton48Ptr = (ZKButton*)findControlByID(ID_MAIN_Button48);
    mTextView22Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView22);
    mButton47Ptr = (ZKButton*)findControlByID(ID_MAIN_Button47);
    mButton46Ptr = (ZKButton*)findControlByID(ID_MAIN_Button46);
    mButton45Ptr = (ZKButton*)findControlByID(ID_MAIN_Button45);
    mButton44Ptr = (ZKButton*)findControlByID(ID_MAIN_Button44);
    mButton43Ptr = (ZKButton*)findControlByID(ID_MAIN_Button43);
    mButton42Ptr = (ZKButton*)findControlByID(ID_MAIN_Button42);
    mTextView21Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView21);
    mTextView20Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView20);
    mTextView19Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView19);
    mTextView18Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView18);
    mTextView17Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView17);
    mTextView16Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView16);
    mTextView15Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView15);
    mTextView14Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView14);
    mButton41Ptr = (ZKButton*)findControlByID(ID_MAIN_Button41);
    mButton40Ptr = (ZKButton*)findControlByID(ID_MAIN_Button40);
    mButton39Ptr = (ZKButton*)findControlByID(ID_MAIN_Button39);
    mButton38Ptr = (ZKButton*)findControlByID(ID_MAIN_Button38);
    mButton37Ptr = (ZKButton*)findControlByID(ID_MAIN_Button37);
    mButton36Ptr = (ZKButton*)findControlByID(ID_MAIN_Button36);
    mButton35Ptr = (ZKButton*)findControlByID(ID_MAIN_Button35);
    mButton34Ptr = (ZKButton*)findControlByID(ID_MAIN_Button34);
    mButton33Ptr = (ZKButton*)findControlByID(ID_MAIN_Button33);
    mButton32Ptr = (ZKButton*)findControlByID(ID_MAIN_Button32);
    mButton31Ptr = (ZKButton*)findControlByID(ID_MAIN_Button31);
    mButton30Ptr = (ZKButton*)findControlByID(ID_MAIN_Button30);
    mTextView13Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView13);
    mTextView12Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView12);
    mTextView11Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView11);
    mButton29Ptr = (ZKButton*)findControlByID(ID_MAIN_Button29);
    mTextView10Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView10);
    mTextView9Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView9);
    mTextView8Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView8);
    mTextView7Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView7);
    mTextView6Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView6);
    mTextView5Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView5);
    mTextView4Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView4);
    mTextView3Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView3);
    mZaxisPPtr = (ZKTextView*)findControlByID(ID_MAIN_ZaxisP);
    mYaxisPPtr = (ZKTextView*)findControlByID(ID_MAIN_YaxisP);
    mXaxisPPtr = (ZKTextView*)findControlByID(ID_MAIN_XaxisP);
    mFileNamePtr = (ZKEditText*)findControlByID(ID_MAIN_FileName);if(mFileNamePtr!= NULL){mFileNamePtr->setTextChangeListener(this);}
    mButton28Ptr = (ZKButton*)findControlByID(ID_MAIN_Button28);
    mButton27Ptr = (ZKButton*)findControlByID(ID_MAIN_Button27);
    mButton26Ptr = (ZKButton*)findControlByID(ID_MAIN_Button26);
    mButton25Ptr = (ZKButton*)findControlByID(ID_MAIN_Button25);
    mTextView2Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView2);
    mTextView1Ptr = (ZKTextView*)findControlByID(ID_MAIN_TextView1);
    mListView1Ptr = (ZKListView*)findControlByID(ID_MAIN_ListView1);if(mListView1Ptr!= NULL){mListView1Ptr->setListAdapter(this);mListView1Ptr->setItemClickListener(this);}
    mPainter3Ptr = (ZKPainter*)findControlByID(ID_MAIN_Painter3);
    mFileWindowPtr = (ZKWindow*)findControlByID(ID_MAIN_FileWindow);
    mButton24Ptr = (ZKButton*)findControlByID(ID_MAIN_Button24);
    mTextview29Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview29);
    mTextview28Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview28);
    mConfigWindow4Ptr = (ZKWindow*)findControlByID(ID_MAIN_ConfigWindow4);
    mTextview27Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview27);
    mConfigWindow3Ptr = (ZKWindow*)findControlByID(ID_MAIN_ConfigWindow3);
    mTextview26Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview26);
    mConfigWindow2Ptr = (ZKWindow*)findControlByID(ID_MAIN_ConfigWindow2);
    mTextview25Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview25);
    mConfigWindow1Ptr = (ZKWindow*)findControlByID(ID_MAIN_ConfigWindow1);
    mButton23Ptr = (ZKButton*)findControlByID(ID_MAIN_Button23);
    mButton22Ptr = (ZKButton*)findControlByID(ID_MAIN_Button22);
    mButton19Ptr = (ZKButton*)findControlByID(ID_MAIN_Button19);
    mButton17Ptr = (ZKButton*)findControlByID(ID_MAIN_Button17);
    mConfigWindowsPtr = (ZKWindow*)findControlByID(ID_MAIN_ConfigWindows);
    mTextview24Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview24);
    mMonitorWindow3Ptr = (ZKWindow*)findControlByID(ID_MAIN_MonitorWindow3);
    mTextview23Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview23);
    mMonitorWindow2Ptr = (ZKWindow*)findControlByID(ID_MAIN_MonitorWindow2);
    mMonitorWindow1Ptr = (ZKWindow*)findControlByID(ID_MAIN_MonitorWindow1);
    mButton21Ptr = (ZKButton*)findControlByID(ID_MAIN_Button21);
    mButton18Ptr = (ZKButton*)findControlByID(ID_MAIN_Button18);
    mButton20Ptr = (ZKButton*)findControlByID(ID_MAIN_Button20);
    mMonitorWindowsPtr = (ZKWindow*)findControlByID(ID_MAIN_MonitorWindows);
    mTextview21Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview21);
    mTeachWindow4Ptr = (ZKWindow*)findControlByID(ID_MAIN_TeachWindow4);
    mTextview20Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview20);
    mTeachWindow3Ptr = (ZKWindow*)findControlByID(ID_MAIN_TeachWindow3);
    mTextview19Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview19);
    mTeachWindow2Ptr = (ZKWindow*)findControlByID(ID_MAIN_TeachWindow2);
    mListview1Ptr = (ZKListView*)findControlByID(ID_MAIN_Listview1);if(mListview1Ptr!= NULL){mListview1Ptr->setListAdapter(this);mListview1Ptr->setItemClickListener(this);}
    mButton16Ptr = (ZKButton*)findControlByID(ID_MAIN_Button16);
    mButton15Ptr = (ZKButton*)findControlByID(ID_MAIN_Button15);
    mButton14Ptr = (ZKButton*)findControlByID(ID_MAIN_Button14);
    mButton13Ptr = (ZKButton*)findControlByID(ID_MAIN_Button13);
    mTextview15Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview15);
    mTeachWindow1Ptr = (ZKWindow*)findControlByID(ID_MAIN_TeachWindow1);
    mTeachWindowsPtr = (ZKWindow*)findControlByID(ID_MAIN_TeachWindows);
    mTextview17Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview17);
    mFuncWindow3Ptr = (ZKWindow*)findControlByID(ID_MAIN_FuncWindow3);
    mTextview16Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview16);
    mFuncWindow2Ptr = (ZKWindow*)findControlByID(ID_MAIN_FuncWindow2);
    mTextview14Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview14);
    mFuncWindow1Ptr = (ZKWindow*)findControlByID(ID_MAIN_FuncWindow1);
    mButton4Ptr = (ZKButton*)findControlByID(ID_MAIN_Button4);
    mButton12Ptr = (ZKButton*)findControlByID(ID_MAIN_Button12);
    mButton11Ptr = (ZKButton*)findControlByID(ID_MAIN_Button11);
    mFuncWindowsPtr = (ZKWindow*)findControlByID(ID_MAIN_FuncWindows);
    mTextview6Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview6);
    mButton7Ptr = (ZKButton*)findControlByID(ID_MAIN_Button7);
    mTextview11Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview11);
    mTextview9Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview9);
    mTextview4Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview4);
    mTextview10Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview10);
    mButton10Ptr = (ZKButton*)findControlByID(ID_MAIN_Button10);
    mButton5Ptr = (ZKButton*)findControlByID(ID_MAIN_Button5);
    mTextview8Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview8);
    mTextview13Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview13);
    mButton1Ptr = (ZKButton*)findControlByID(ID_MAIN_Button1);
    mButton3Ptr = (ZKButton*)findControlByID(ID_MAIN_Button3);
    mTextview12Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview12);
    mTextview5Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview5);
    mButton2Ptr = (ZKButton*)findControlByID(ID_MAIN_Button2);
    mButton9Ptr = (ZKButton*)findControlByID(ID_MAIN_Button9);
    mButton6Ptr = (ZKButton*)findControlByID(ID_MAIN_Button6);
    mButton8Ptr = (ZKButton*)findControlByID(ID_MAIN_Button8);
    mTextview18Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview18);
    mDigitalclock1Ptr = (ZKDigitalClock*)findControlByID(ID_MAIN_Digitalclock1);
    mTextview2Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview2);
    mPainter2Ptr = (ZKPainter*)findControlByID(ID_MAIN_Painter2);
    mPainter1Ptr = (ZKPainter*)findControlByID(ID_MAIN_Painter1);
    mTextview1Ptr = (ZKTextView*)findControlByID(ID_MAIN_Textview1);
	mActivityPtr = this;
	onUI_init();
    registerProtocolDataUpdateListener(onProtocolDataUpdate); 
    rigesterActivityTimer();
}

void mainActivity::onClick(ZKBase *pBase) {
	//TODO: add widget onClik code 
    int buttonTablen = sizeof(sButtonCallbackTab) / sizeof(S_ButtonCallback);
    for (int i = 0; i < buttonTablen; ++i) {
        if (sButtonCallbackTab[i].id == pBase->getID()) {
            if (sButtonCallbackTab[i].callback((ZKButton*)pBase)) {
            	return;
            }
            break;
        }
    }


    int len = sizeof(sAppInfoTab) / sizeof(sAppInfoTab[0]);
    for (int i = 0; i < len; ++i) {
        if (sAppInfoTab[i].id == pBase->getID()) {
            EASYUICONTEXT->openActivity(sAppInfoTab[i].pApp);
            return;
        }
    }

	Activity::onClick(pBase);
}

void mainActivity::onResume() {
	Activity::onResume();
	EASYUICONTEXT->registerGlobalTouchListener(this);
	startVideoLoopPlayback();
	onUI_show();
}

void mainActivity::onPause() {
	Activity::onPause();
	EASYUICONTEXT->unregisterGlobalTouchListener(this);
	stopVideoLoopPlayback();
	onUI_hide();
}

void mainActivity::onIntent(const Intent *intentPtr) {
	Activity::onIntent(intentPtr);
	onUI_intent(intentPtr);
}

bool mainActivity::onTimer(int id) {
	return onUI_Timer(id);
}

void mainActivity::onProgressChanged(ZKSeekBar *pSeekBar, int progress){

    int seekBarTablen = sizeof(SZKSeekBarCallbackTab) / sizeof(S_ZKSeekBarCallback);
    for (int i = 0; i < seekBarTablen; ++i) {
        if (SZKSeekBarCallbackTab[i].id == pSeekBar->getID()) {
            SZKSeekBarCallbackTab[i].callback(pSeekBar, progress);
            break;
        }
    }
}

int mainActivity::getListItemCount(const ZKListView *pListView) const{
    int tablen = sizeof(SListViewFunctionsCallbackTab) / sizeof(S_ListViewFunctionsCallback);
    for (int i = 0; i < tablen; ++i) {
        if (SListViewFunctionsCallbackTab[i].id == pListView->getID()) {
            return SListViewFunctionsCallbackTab[i].getListItemCountCallback(pListView);
            break;
        }
    }
    return 0;
}

void mainActivity::obtainListItemData(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index){
    int tablen = sizeof(SListViewFunctionsCallbackTab) / sizeof(S_ListViewFunctionsCallback);
    for (int i = 0; i < tablen; ++i) {
        if (SListViewFunctionsCallbackTab[i].id == pListView->getID()) {
            SListViewFunctionsCallbackTab[i].obtainListItemDataCallback(pListView, pListItem, index);
            break;
        }
    }
}

void mainActivity::onItemClick(ZKListView *pListView, int index, int id){
    int tablen = sizeof(SListViewFunctionsCallbackTab) / sizeof(S_ListViewFunctionsCallback);
    for (int i = 0; i < tablen; ++i) {
        if (SListViewFunctionsCallbackTab[i].id == pListView->getID()) {
            SListViewFunctionsCallbackTab[i].onItemClickCallback(pListView, index, id);
            break;
        }
    }
}

void mainActivity::onSlideItemClick(ZKSlideWindow *pSlideWindow, int index) {
    int tablen = sizeof(SSlideWindowItemClickCallbackTab) / sizeof(S_SlideWindowItemClickCallback);
    for (int i = 0; i < tablen; ++i) {
        if (SSlideWindowItemClickCallbackTab[i].id == pSlideWindow->getID()) {
            SSlideWindowItemClickCallbackTab[i].onSlideItemClickCallback(pSlideWindow, index);
            break;
        }
    }
}

bool mainActivity::onTouchEvent(const MotionEvent &ev) {
    return onmainActivityTouchEvent(ev);
}

void mainActivity::onTextChanged(ZKTextView *pTextView, const std::string &text) {
    int tablen = sizeof(SEditTextInputCallbackTab) / sizeof(S_EditTextInputCallback);
    for (int i = 0; i < tablen; ++i) {
        if (SEditTextInputCallbackTab[i].id == pTextView->getID()) {
            SEditTextInputCallbackTab[i].onEditTextChangedCallback(text);
            break;
        }
    }
}

void mainActivity::rigesterActivityTimer() {
    int tablen = sizeof(REGISTER_ACTIVITY_TIMER_TAB) / sizeof(S_ACTIVITY_TIMEER);
    for (int i = 0; i < tablen; ++i) {
        S_ACTIVITY_TIMEER temp = REGISTER_ACTIVITY_TIMER_TAB[i];
        registerTimer(temp.id, temp.time);
    }
}


void mainActivity::onVideoPlayerMessage(ZKVideoView *pVideoView, int msg) {
    int tablen = sizeof(SVideoViewCallbackTab) / sizeof(S_VideoViewCallback);
    for (int i = 0; i < tablen; ++i) {
        if (SVideoViewCallbackTab[i].id == pVideoView->getID()) {
        	if (SVideoViewCallbackTab[i].loop) {
                //循环播放
        		videoLoopPlayback(pVideoView, msg, i);
        	} else if (SVideoViewCallbackTab[i].onVideoViewCallback != NULL){
        	    SVideoViewCallbackTab[i].onVideoViewCallback(pVideoView, msg);
        	}
            break;
        }
    }
}

void mainActivity::videoLoopPlayback(ZKVideoView *pVideoView, int msg, size_t callbackTabIndex) {

	switch (msg) {
	case ZKVideoView::E_MSGTYPE_VIDEO_PLAY_STARTED:
		LOGD("ZKVideoView::E_MSGTYPE_VIDEO_PLAY_STARTED\n");
    if (callbackTabIndex >= (sizeof(SVideoViewCallbackTab)/sizeof(S_VideoViewCallback))) {
      break;
    }
		pVideoView->setVolume(SVideoViewCallbackTab[callbackTabIndex].defaultvolume / 10.0);
		mVideoLoopErrorCount = 0;
		break;
	case ZKVideoView::E_MSGTYPE_VIDEO_PLAY_ERROR:
		/**错误处理 */
		++mVideoLoopErrorCount;
		if (mVideoLoopErrorCount > 100) {
			LOGD("video loop error counts > 100, quit loop playback !");
            break;
		} //不用break, 继续尝试播放下一个
	case ZKVideoView::E_MSGTYPE_VIDEO_PLAY_COMPLETED:
		LOGD("ZKVideoView::E_MSGTYPE_VIDEO_PLAY_COMPLETED\n");
        std::vector<std::string> videolist;
        std::string fileName(getAppName());
        if (fileName.size() < 4) {
             LOGD("getAppName size < 4, ignore!");
             break;
        }
        fileName = fileName.substr(0, fileName.length() - 4) + "_video_list.txt";
        fileName = "/mnt/extsd/" + fileName;
        if (!parseVideoFileList(fileName.c_str(), videolist)) {
            LOGD("parseVideoFileList failed !");
		    break;
        }
		if (pVideoView && !videolist.empty()) {
			mVideoLoopIndex = (mVideoLoopIndex + 1) % videolist.size();
			pVideoView->play(videolist[mVideoLoopIndex].c_str());
		}
		break;
	}
}

void mainActivity::startVideoLoopPlayback() {
    int tablen = sizeof(SVideoViewCallbackTab) / sizeof(S_VideoViewCallback);
    for (int i = 0; i < tablen; ++i) {
    	if (SVideoViewCallbackTab[i].loop) {
    		ZKVideoView* videoView = (ZKVideoView*)findControlByID(SVideoViewCallbackTab[i].id);
    		if (!videoView) {
    			return;
    		}
    		//循环播放
    		videoLoopPlayback(videoView, ZKVideoView::E_MSGTYPE_VIDEO_PLAY_COMPLETED, i);
    		return;
    	}
    }
}

void mainActivity::stopVideoLoopPlayback() {
    int tablen = sizeof(SVideoViewCallbackTab) / sizeof(S_VideoViewCallback);
    for (int i = 0; i < tablen; ++i) {
    	if (SVideoViewCallbackTab[i].loop) {
    		ZKVideoView* videoView = (ZKVideoView*)findControlByID(SVideoViewCallbackTab[i].id);
    		if (!videoView) {
    			return;
    		}
    		if (videoView->isPlaying()) {
    		    videoView->stop();
    		}
    		return;
    	}
    }
}

bool mainActivity::parseVideoFileList(const char *pFileListPath, std::vector<string>& mediaFileList) {
	mediaFileList.clear();
	if (NULL == pFileListPath || 0 == strlen(pFileListPath)) {
        LOGD("video file list is null!");
		return false;
	}

	ifstream is(pFileListPath, ios_base::in);
	if (!is.is_open()) {
		LOGD("cann't open file %s \n", pFileListPath);
		return false;
	}
	char tmp[1024] = {0};
	while (is.getline(tmp, sizeof(tmp))) {
		string str = tmp;
		removeCharFromString(str, '\"');
		removeCharFromString(str, '\r');
		removeCharFromString(str, '\n');
		if (str.size() > 1) {
     		mediaFileList.push_back(str.c_str());
		}
	}
	LOGD("(f:%s, l:%d) parse fileList[%s], get [%d]files\n", __FUNCTION__,
			__LINE__, pFileListPath, mediaFileList.size());
	for (size_t i = 0; i < mediaFileList.size(); i++) {
		LOGD("file[%d]:[%s]\n", i, mediaFileList[i].c_str());
	}
	is.close();

	return true;
}

int mainActivity::removeCharFromString(string& nString, char c) {
    string::size_type   pos;
    while(1) {
        pos = nString.find(c);
        if(pos != string::npos) {
            nString.erase(pos, 1);
        } else {
            break;
        }
    }
    return (int)nString.size();
}

void mainActivity::registerUserTimer(int id, int time) {
	registerTimer(id, time);
}

void mainActivity::unregisterUserTimer(int id) {
	unregisterTimer(id);
}

void mainActivity::resetUserTimer(int id, int time) {
	resetTimer(id, time);
}